--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\r
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\r
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\r
+ width="12px" height="18px" viewBox="-0.5 0.5 12 18" enable-background="new -0.5 0.5 12 18" xml:space="preserve">\r
+<g id="Captions">\r
+</g>\r
+<path d="M9.5,11.5h-7l-3-3v3v5c0,1.105,0.895,2,2,2h8c1.105,0,2-0.895,2-2v-3C11.5,12.395,10.605,11.5,9.5,11.5z M9.5,16.5h-8v-1h8\r
+ V16.5z M9.5,14.5h-8v-1h8V14.5z"/>\r
+<path d="M9.5,0.5h-8c-1.105,0-2,0.895-2,2v3c0,1.105,0.895,2,2,2h7l3,3v-3v-5C11.5,1.395,10.605,0.5,9.5,0.5z M9.5,5.5h-8v-1h8V5.5z\r
+ M9.5,3.5h-8v-1h8V3.5z"/>\r
+</svg>\r
"/icons2/scalable/one-two-symbolic-rtl.svg");
}
+static void
+test_nonsquare_symbolic (void)
+{
+ gint width, height;
+ GtkIconTheme *icon_theme;
+ GtkIconInfo *info;
+ GFile *file;
+ GIcon *icon;
+ GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
+ gboolean was_symbolic = FALSE;
+ GError *error = NULL;
+ gchar *path = g_build_filename (g_test_get_dir (G_TEST_DIST),
+ "icons",
+ "scalable",
+ "nonsquare-symbolic.svg",
+ NULL);
+
+ /* load the original image for reference */
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path, &error);
+ g_assert_no_error (error);
+ g_assert_nonnull (pixbuf);
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ g_assert_cmpint (width, !=, height);
+
+ /* now load it through GtkIconTheme */
+ icon_theme = gtk_icon_theme_get_default ();
+ file = g_file_new_for_path (path);
+ icon = g_file_icon_new (file);
+ info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, icon,
+ height, 1, 0);
+ g_assert_nonnull (info);
+
+ g_object_unref (pixbuf);
+ pixbuf = gtk_icon_info_load_symbolic (info, &black, NULL, NULL, NULL,
+ &was_symbolic, &error);
+
+ /* we are loaded successfully */
+ g_assert_no_error (error);
+ g_assert_nonnull (pixbuf);
+ g_assert_true (was_symbolic);
+
+ /* the original dimensions have been preserved */
+ g_assert_cmpint (gdk_pixbuf_get_width (pixbuf), ==, width);
+ g_assert_cmpint (gdk_pixbuf_get_height (pixbuf), ==, height);
+
+ g_free (path);
+ g_object_unref (pixbuf);
+ g_object_unref (file);
+ g_object_unref (icon);
+ g_object_unref (info);
+}
+
int
main (int argc, char *argv[])
{
g_test_add_func ("/icontheme/list", test_list);
g_test_add_func ("/icontheme/async", test_async);
g_test_add_func ("/icontheme/inherit", test_inherit);
+ g_test_add_func ("/icontheme/nonsquare-symbolic", test_nonsquare_symbolic);
return g_test_run();
}